<%-- 
    Document   : managePADetails
    Created on : Sep 28, 2011, 8:38:03 PM
    Author     : s4201567 Tony Yu

<script language="javascript">
    
    function testResults (form) {
        var TestVar = form.things.value;
        document.getElementById('content').innerHTML += TestVar;
    }
    
</script>
            <INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults(this.form)" />
   --%>         

<style type="text/css">
   .error { color: red; }
       
    #master-title {
        text-align:center;
    }
    
    #pa-list {
        padding-left: 240px;
    }
</style>
   
<%@ include file="../header.jsp" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div id="content-container1">
    <div id="content">
        <% if (request.getParameter("pid") != null && request.getParameter("type") != null) { %>
        <div id="master-title">
            <h3>Edit Poll Administrator Details</h3>
        </div>
        <!-- Content goes here -->     
        <div id="pa-list">
            <form:form method="post" commandName="editPADetails">
                <%
                    Object pid = request.getParameter("pid");
                    int type = Integer.parseInt(request.getParameter("type"));
                    int t = type;
                %> 
                <form:input path='pAdminID' type='hidden' value='<%=pid%>'/>
                <table bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5">
                <%
                    if (t == 0) {
                %>
                <tr>
                  <td>Date of Expiry:</td>
                    <td>
                        <form:input path="numExpiryDays"/>
                    </td>
                    <td>
                        <form:errors path="numExpiryDays" cssClass="error"/>
                    </td>
                </tr>
                <% }  if (t == 1) { %>
                 <tr>
                  <td>Email:</td>
                    <td>
                        <form:input path="email"/>
                    </td>
                    <td>
                        <form:errors path="email" cssClass="error"/>
                    </td>
                </tr>
                <% } %>
              </table>
                <br>
                <input type="submit" align="center" value="Submit">
                <input type="reset" value="Reset" name="reset"><br/><br/>
                <form>
                    <input type="button" onClick="window.location.href='../sysadmin/managePADetails.html?pid=<%=pid%>'" value="Back"/>
                </form>
            </form:form>
        </div>  
        <% } else
            out.println("<p>The page was improperally formed, try going back and trying again.</p>");
        %>
    </div>
</div>		

<%@ include file="../footer.jsp" %>